import { observable, action } from 'mobx';
import service from "../libs/request";
import { message } from "antd";

class FormTablesStore{
    @observable form;

    @action setFrom(from){
        this.form = from;
    }

    @action summitData(uri,data){
        this.form.validateFields((err, formData) => {
            formData = {...formData,...data};
            service.request({
                url:uri,
                method:"post",
                data:formData,
            }).then(response => {
                if (response.data.code === 200){

                }else {
                    message.error(response.data.msg);
                }
            }).catch(err=>{
                console.log(err)
            })

        });
    }
}

export default new FormTablesStore()